package org.lee.controller;

import java.util.List;

import org.lee.bean.common.CustomBean;
import org.lee.bean.domain1.Person1;
import org.lee.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("person1")
public class Person1Controller {

	@Autowired PersonService service;
	
	@RequestMapping(value="search")
	public Person1 search(int id){
		return service.find1(id);
	}
	
	@RequestMapping(value="add")
	public Person1 add(@RequestParam(value="fail", defaultValue="false", required=false) boolean fail){
		return service.save1(fail);
	}
	
	@RequestMapping(value="search/native")
	public List<CustomBean> seachNative(@RequestParam(value="id", defaultValue="1", required=false) int id){
		return service.findCustomBean1(id);
	}
}
